package youth;

public class Circle {
    private double r;

    // 构造函数
    public Circle(double r) {
        this.r = r;}

    // 设置半径
    public void setR(double r) {
        this.r = r;}

    // 获取半径
    public double getR() {
        return r;}

    // 计算面积
    public double s() {
        return Math.PI * r * r;}

    // 计算周长
    public double c() {
        return 2 * Math.PI * r;}

    public static void main(String[] args) {
        // 创建Circle对象，半径为6
        Circle circle = new Circle(6);

        // 计算并输出周长和面积
        System.out.println("周长: " + circle.c());
        System.out.println("面积: " + circle.s());
    }
}


